/* Structure for a tableau pile */
typedef struct {
    int buildsuit;	/* One of the S_* values below */
    int buildstep;	/* Usually -1 */
    int movesuit;	/* Suit rule for moving stacks */
    int movestep;	/* Step for moving stacks - npip means no rule */
    int basecard;	/* Low pip value - if 0, we enable wrapping */
    int fillblank;	/* Can only fill blanks with kings? */
    int nobreak;	/* Don't break sequences when moving off */
    int beginset;	/* First column of this tableau set */
    int id;		/* ID number of stack with current contents */
} TableauStack;

#define F_NONE 0
#define F_ANYTHING 1
#define F_KINGONLY 2
#define F_KINGLEFT 3	/* King only, or full stack from next column */

/* Deal Flip valeus */
#define FLIP_NONE 0
#define FLIP_ONE 1
#define FLIP_TWO 2
#define FLIP_THREE 3
#define FLIP_FOUR 4
#define FLIP_ALL 100

/* NoBreak values */
#define BREAK_ANYWHERE 0/* Break sequences anywhere */
#define BREAK_NOFIT 1	/* Break sequences where they don't fit build rule */
#define BREAK_NOWHERE 2	/* Move longest possible movable sequence */

extern TableauStack *tableau;

void makeTableau(int ndeal, int dealflip, Stack *deal,
	    int buildsuit, int buildstep, int movesuit, int movestep,
	    int basecard, int fillblank, int nobreak, int beginset);
void printTableau(FILE *f, Stack *stks);
void cleanTableau(void);
void gatherTableau(Stack *s);
int tableau_firstMove(Stack *stack, int *index1, int *len);
int tableau_nextMove(Stack *stack, int *index1, int *len);
int isfaceup(int dealflip, int i);
